package com.hzcc.wechatpayback.module.controller;

import com.hzcc.wechatpayback.common.ResultResponse;
import com.hzcc.wechatpayback.module.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author hzcc
 * @Date 2022/4/22
 * 商品controller层
 */

@Api(tags = "商品管理")
@CrossOrigin
@Slf4j
@RestController
@RequestMapping("/api/pro")
public class ProductionController {

    @Resource
    private ProductService productService;

    @ApiOperation("测试接口")
    @GetMapping("/test")
    public ResultResponse test(){
        log.info("访问测试接口");
        return ResultResponse.defaultSuccessResultResponse("hello，world").data("1","11111").data("22","4444444");
    }

    @ApiOperation("商品数据")
    @GetMapping("/list")
    public ResultResponse list(){
        return ResultResponse.defaultSuccessResultResponse().data("pro",productService.list());
    }

}
